<header id="vmaig-header" class="navbar navbar-inverse navbar-fixed-top navbar-vmaig">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#vmaig-navbar-collapse">
                <span class="sr-only">切换导航</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <div class="navbar-brand">ONES</div>
        </div>
        <div class="collapse navbar-collapse" id="vmaig-navbar-collapse">
            <ul class="nav navbar-nav">
                <li class="">
                <a href="/index">
                    <span class="glyphicon glyphicon-home"></span>
                    首页
                </a>
                </li>
                <li>
                <a href="{% url 'index:ArticleEdit' %}">
                    <span class="glyphicon glyphicon-globe"></span>
                    写博客
                </a>
                </li>
                <li>
                <a href="/news">
                    <span class="glyphicon glyphicon-star-empty"></span>
                    新闻
                </a>
                </li>
                  <form class="navbar-form navbar-left" role="search" action="/index/search/" method="get">
                      <div class="form-group">
                        <input type="text" class="form-control" placeholder="Search" name="search">
                      </div>
                      <button type="submit" class="btn btn-default">Submit</button>
                  </form>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                {% if not user.is_authenticated %}
                <li>
                    <a  id="nav-login" href="{% url 'index:blog.views.loginview'%}"   style="padding-right:0px;cursor:pointer;">
                    登陆
                    </a>
                </li>
                <li>
                    <a  id="nav-register" href="{% url 'index:register'%}"  style="padding-right:0px;cursor:pointer">
                    注册
                    </a>
                </li>
                {%else%}
                <li class="dropdown">
                <a href="javascript:;" style="padding:5px;" data-toggle="dropdown">
                        <img src="{{user.img}}" alt="" width="40">
                        &nbsp;{{user.username}}
                        <span class="badge" style="background-color: #D94600;">0</span>
                </a>
                <ul class="dropdown-menu navbar-right">
                    <li><a href="/user/changetx">
                        <span class="glyphicon glyphicon-user"></span>
                        更改头像</a></li>
                    <li><a href="/user/changepassword">
                        <span class="glyphicon glyphicon-envelope"></span>
                        更改密码</a></li>
                    <li><a id="logout" href="{% url 'index:blog.views.loginoutview'%}">
                        <span class="glyphicon glyphicon-log-out"></span>
                        退出</a></li>
                </ul>
                </li>
                {% endif %}
            </ul>
        </div>
    </div>
</header>
